<template>
  <div class="x-refund-warning">
    <n-alert
      v-if="refundWarning && refundWarning.open"
      title="售后退款异常"
      type="warning"
      closable
      style="margin-bottom: 10px"
    >
      商户号：({{
        refundWarning.subMich
      }})已无足够金额，导致售后退款失败。为避免客户投诉，请根据当前未处理的售后退款金额，尽快完成充值，系统将再次执行退款！
    </n-alert>
  </div>
</template>

<script lang="ts">
  import { computed, defineComponent, onMounted, reactive, toRefs } from 'vue'
  import { NAlert } from 'naive-ui'
  import { useStore } from '@/store'
  import { isBms } from '@/utils/is'

  export default defineComponent({
    name: 'XRefundWarning',
    components: {
      NAlert
    },
    setup() {
      const $store = useStore()
      const $state: any = reactive({
        refundWarning: computed(() => $store.state.user?.refundWarning)
      })

      onMounted(() => {
        if (isBms) {
          $store.dispatch('user/showAdWatcherPrompt', {
            type: 1
          })
        }
      })

      return {
        ...toRefs($state)
      }
    }
  })
</script>

<style scoped></style>
